home *** CD-ROM | disk | FTP | other *** search
/ Developer CD Series 1995 August: Tool Chest / Dev.CD Aug 95 TC / Dev.CD Aug 95 TC.toast / New System Software Extensions / QuickDraw™ 3D 1.0 / Development / Interfaces / QD3DLight.h < prev    next >
Encoding:
C/C++ Source or Header  |  1995-06-02  |  8.4 KB  |  308 lines  |  [TEXT/MPS ]

  1. /******************************************************************************
  2.  **                                                                             **
  3.  **     Module:        QD3DLight.h                                                  **
  4.  **                                                                          **
  5.  **                                                                          **
  6.  **                                                                          **
  7.  **     Purpose:     Generic light routines                                      **
  8.  **                                                                          **
  9.  **                                                                          **
  10.  **     Copyright (C) 1991-1995 Apple Computer, Inc. All rights reserved.     **    
  11.  **                                                                          **
  12.  **                                                                             **
  13.  *****************************************************************************/
  14. #ifndef QD3DLight_h
  15. #define QD3DLight_h
  16.  
  17. #ifndef QD3D_h
  18. #include "QD3D.h"
  19. #endif  /*  QD3D_h  */
  20.  
  21. #if PRAGMA_ONCE
  22.     #pragma once
  23. #endif
  24.  
  25. #ifdef __cplusplus
  26. extern "C" {
  27. #endif    /* __cplusplus */
  28.  
  29. /******************************************************************************
  30.  **                                                                             **
  31.  **                            Enum Definitions                                 **
  32.  **                                                                             **
  33.  *****************************************************************************/
  34.  
  35. typedef enum TQ3AttenuationType {
  36.     kQ3AttenuationTypeNone,
  37.     kQ3AttenuationTypeInverseDistance,
  38.     kQ3AttenuationTypeInverseDistanceSquared
  39. } TQ3AttenuationType;
  40.  
  41.  
  42. typedef enum TQ3FallOffType {
  43.     kQ3FallOffTypeNone,
  44.     kQ3FallOffTypeLinear,
  45.     kQ3FallOffTypeExponential,
  46.     kQ3FallOffTypeCosine
  47. } TQ3FallOffType;
  48.  
  49.  
  50. /******************************************************************************
  51.  **                                                                             **
  52.  **                            Data Structure Definitions                         **
  53.  **                                                                             **
  54.  *****************************************************************************/
  55.  
  56. typedef struct TQ3LightData {
  57.     TQ3Boolean            isOn;
  58.     float                brightness;
  59.     TQ3ColorRGB            color;
  60. } TQ3LightData;
  61.  
  62. typedef struct TQ3DirectionalLightData {
  63.     TQ3LightData        lightData;
  64.     TQ3Boolean            castsShadows;
  65.     TQ3Vector3D            direction;
  66. } TQ3DirectionalLightData;
  67.  
  68. typedef struct TQ3PointLightData {
  69.     TQ3LightData        lightData;
  70.     TQ3Boolean            castsShadows;
  71.     TQ3AttenuationType    attenuation;
  72.     TQ3Point3D            location;
  73. } TQ3PointLightData;
  74.  
  75. typedef struct TQ3SpotLightData {
  76.     TQ3LightData        lightData;
  77.     TQ3Boolean            castsShadows;
  78.     TQ3AttenuationType    attenuation;
  79.     TQ3Point3D            location;
  80.     TQ3Vector3D            direction;
  81.     float                hotAngle;
  82.     float                outerAngle;
  83.     TQ3FallOffType        fallOff;
  84. } TQ3SpotLightData;
  85.  
  86.  
  87. /******************************************************************************
  88.  **                                                                             **
  89.  **                    Light routines (apply to all TQ3LightObjects)             **
  90.  **                                                                             **
  91.  *****************************************************************************/
  92.  
  93. QD3D_EXPORT TQ3ObjectType Q3Light_GetType(
  94.     TQ3LightObject        light);
  95.  
  96. QD3D_EXPORT TQ3Status Q3Light_GetState(
  97.     TQ3LightObject        light,
  98.     TQ3Boolean            *isOn);
  99.                 
  100. QD3D_EXPORT TQ3Status Q3Light_GetBrightness(
  101.     TQ3LightObject        light,
  102.     float                *brightness);
  103.     
  104. QD3D_EXPORT TQ3Status Q3Light_GetColor(
  105.     TQ3LightObject        light,
  106.     TQ3ColorRGB            *color);
  107.     
  108. QD3D_EXPORT TQ3Status Q3Light_SetState(
  109.     TQ3LightObject        light,
  110.     TQ3Boolean            isOn);
  111.                 
  112. QD3D_EXPORT TQ3Status Q3Light_SetBrightness(
  113.     TQ3LightObject        light,
  114.     float                brightness);
  115.     
  116. QD3D_EXPORT TQ3Status Q3Light_SetColor(
  117.     TQ3LightObject        light,
  118.     const TQ3ColorRGB    *color);
  119.  
  120. QD3D_EXPORT TQ3Status Q3Light_GetData(
  121.     TQ3LightObject        light,
  122.     TQ3LightData        *lightData);
  123.  
  124. QD3D_EXPORT TQ3Status Q3Light_SetData(
  125.     TQ3LightObject        light,
  126.     const TQ3LightData    *lightData);
  127.     
  128.  
  129. /******************************************************************************
  130.  **                                                                             **
  131.  **                            Specific Light Routines                               **
  132.  **                                                                             **
  133.  *****************************************************************************/
  134.  
  135. /******************************************************************************
  136.  **                                                                             **
  137.  **                            Ambient Light                                       **
  138.  **                                                                             **
  139.  *****************************************************************************/
  140.  
  141. QD3D_EXPORT TQ3LightObject Q3AmbientLight_New(
  142.     const TQ3LightData                *lightData);
  143.  
  144. QD3D_EXPORT TQ3Status Q3AmbientLight_GetData(
  145.     TQ3LightObject                    light,
  146.     TQ3LightData                    *lightData);
  147.  
  148. QD3D_EXPORT TQ3Status Q3AmbientLight_SetData(
  149.     TQ3LightObject                    light,
  150.     const TQ3LightData                *lightData);
  151.  
  152.  
  153. /******************************************************************************
  154.  **                                                                             **
  155.  **                        Directional Light                                     **
  156.  **                                                                             **
  157.  *****************************************************************************/
  158.  
  159. QD3D_EXPORT TQ3LightObject Q3DirectionalLight_New(
  160.     const TQ3DirectionalLightData    *directionalLightData);
  161.     
  162. QD3D_EXPORT TQ3Status Q3DirectionalLight_GetCastShadowsState(
  163.     TQ3LightObject                    light,
  164.     TQ3Boolean                        *castsShadows);
  165.     
  166. QD3D_EXPORT TQ3Status Q3DirectionalLight_GetDirection(
  167.     TQ3LightObject                    light,
  168.     TQ3Vector3D                        *direction);
  169.     
  170. QD3D_EXPORT TQ3Status Q3DirectionalLight_SetCastShadowsState(
  171.     TQ3LightObject                    light,
  172.     TQ3Boolean                        castsShadows);
  173.     
  174. QD3D_EXPORT TQ3Status Q3DirectionalLight_SetDirection(
  175.     TQ3LightObject                    light,
  176.     const TQ3Vector3D                *direction);
  177.  
  178. QD3D_EXPORT TQ3Status Q3DirectionalLight_GetData(
  179.     TQ3LightObject                    light,
  180.     TQ3DirectionalLightData            *directionalLightData);
  181.  
  182. QD3D_EXPORT TQ3Status Q3DirectionalLight_SetData(
  183.     TQ3LightObject                    light,
  184.     const TQ3DirectionalLightData    *directionalLightData);
  185.  
  186.  
  187. /******************************************************************************
  188.  **                                                                             **
  189.  **                        Point Light                                              **
  190.  **                                                                             **
  191.  *****************************************************************************/
  192.  
  193. QD3D_EXPORT TQ3LightObject Q3PointLight_New(
  194.     const TQ3PointLightData            *pointLightData);
  195.  
  196. QD3D_EXPORT TQ3Status Q3PointLight_GetCastShadowsState(
  197.     TQ3LightObject                    light,
  198.     TQ3Boolean                        *castsShadows);
  199.     
  200. QD3D_EXPORT TQ3Status Q3PointLight_GetAttenuation(
  201.     TQ3LightObject                    light,
  202.     TQ3AttenuationType                *attenuation);
  203.     
  204. QD3D_EXPORT TQ3Status Q3PointLight_GetLocation(
  205.     TQ3LightObject                    light,
  206.     TQ3Point3D                        *location);
  207.  
  208. QD3D_EXPORT TQ3Status Q3PointLight_GetData(
  209.     TQ3LightObject                    light,
  210.     TQ3PointLightData                *pointLightData);
  211.     
  212. QD3D_EXPORT TQ3Status Q3PointLight_SetCastShadowsState(
  213.     TQ3LightObject                    light,
  214.     TQ3Boolean                        castsShadows);
  215.     
  216. QD3D_EXPORT TQ3Status Q3PointLight_SetAttenuation(
  217.     TQ3LightObject                    light,
  218.     TQ3AttenuationType                attenuation);
  219.     
  220. QD3D_EXPORT TQ3Status Q3PointLight_SetLocation(
  221.     TQ3LightObject                    light,
  222.     const TQ3Point3D                *location);
  223.  
  224. QD3D_EXPORT TQ3Status Q3PointLight_SetData(
  225.     TQ3LightObject                    light,
  226.     const TQ3PointLightData            *pointLightData);
  227.     
  228.  
  229. /******************************************************************************
  230.  **                                                                             **
  231.  **                        Spot Light                                              **
  232.  **                                                                             **
  233.  *****************************************************************************/
  234.  
  235. QD3D_EXPORT TQ3LightObject Q3SpotLight_New(
  236.     const TQ3SpotLightData            *spotLightData);
  237.  
  238. QD3D_EXPORT TQ3Status Q3SpotLight_GetCastShadowsState(
  239.     TQ3LightObject                    light,
  240.     TQ3Boolean                        *castsShadows);
  241.     
  242. QD3D_EXPORT TQ3Status Q3SpotLight_GetAttenuation(
  243.     TQ3LightObject                    light,
  244.     TQ3AttenuationType                *attenuation);
  245.     
  246. QD3D_EXPORT TQ3Status Q3SpotLight_GetLocation(
  247.     TQ3LightObject                    light,
  248.     TQ3Point3D                        *location);
  249.         
  250. QD3D_EXPORT TQ3Status Q3SpotLight_GetDirection(
  251.     TQ3LightObject                    light,
  252.     TQ3Vector3D                        *direction);
  253.         
  254. QD3D_EXPORT TQ3Status Q3SpotLight_GetHotAngle(
  255.     TQ3LightObject                    light,
  256.     float                            *hotAngle);
  257.         
  258. QD3D_EXPORT TQ3Status Q3SpotLight_GetOuterAngle(
  259.     TQ3LightObject                    light,
  260.     float                            *outerAngle);
  261.         
  262. QD3D_EXPORT TQ3Status Q3SpotLight_GetFallOff(
  263.     TQ3LightObject                    light,
  264.     TQ3FallOffType                    *fallOff);
  265.  
  266. QD3D_EXPORT TQ3Status Q3SpotLight_GetData(
  267.     TQ3LightObject                    light,
  268.     TQ3SpotLightData                *spotLightData);
  269.  
  270. QD3D_EXPORT TQ3Status Q3SpotLight_SetCastShadowsState(
  271.     TQ3LightObject                    light,
  272.     TQ3Boolean                        castsShadows);
  273.     
  274. QD3D_EXPORT TQ3Status Q3SpotLight_SetAttenuation(
  275.     TQ3LightObject                    light,
  276.     TQ3AttenuationType                attenuation);
  277.     
  278. QD3D_EXPORT TQ3Status Q3SpotLight_SetLocation(
  279.     TQ3LightObject                    light,
  280.     const TQ3Point3D                *location);
  281.  
  282. QD3D_EXPORT TQ3Status Q3SpotLight_SetDirection(
  283.     TQ3LightObject                    light,
  284.     const TQ3Vector3D                *direction);
  285.  
  286. QD3D_EXPORT TQ3Status Q3SpotLight_SetHotAngle(
  287.     TQ3LightObject                    light,
  288.     float                            hotAngle);
  289.         
  290. QD3D_EXPORT TQ3Status Q3SpotLight_SetOuterAngle(
  291.     TQ3LightObject                    light,
  292.     float                            outerAngle);
  293.         
  294. QD3D_EXPORT TQ3Status Q3SpotLight_SetFallOff(
  295.     TQ3LightObject                    light,
  296.     TQ3FallOffType                    fallOff);
  297.  
  298. QD3D_EXPORT TQ3Status Q3SpotLight_SetData(
  299.     TQ3LightObject                    light,
  300.     const TQ3SpotLightData            *spotLightData);
  301.  
  302.  
  303. #ifdef __cplusplus
  304. }
  305. #endif    /* __cplusplus */
  306.  
  307. #endif  /*  QD3DLight_h  */
  308.